/* GUI CONVERTED from rssmtb.p (converter v1.75) Sat Aug 12 23:16:40 2000 */
/* rssmtb.p - Release Management Supplier Schedules                     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                   */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                 */
/* REVISION: 7.3    LAST MODIFIED: 12/11/92           BY: WUG *G462*    */
/* REVISION: 7.3    LAST MODIFIED: 03/18/93           BY: WUG *G841*    */
/* REVISION: 7.3    LAST MODIFIED: 05/20/93           BY: WUG *GA75*    */
/* REVISION: 7.3    LAST MODIFIED: 10/19/94           BY: ljm *GN40     */
/* REVISION: 7.3    LAST MODIFIED: 04/09/95           BY: vrn *G0MD*    */
/* REVISION: 7.4    LAST MODIFIED: 04/15/96           BY: rpw *J0J6*    */
/* REVISION: 7.4    LAST MODIFIED: 03/11/97           BY: *H0TN* Aruna Patil */
/* REVISION: 7.4    LAST MODIFIED: 12/29/97           BY: *H1HV* Jean Miller */

/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane         */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan        */
/* REVISION: 8.6E     LAST MODIFIED: 06/12/98   BY: *J2PK* Samir Bavkar      */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan        */
/* REVISION: 9.0      LAST MODIFIED: 02/11/99   BY: *J39V* Anup Pereira      */
/* REVISION: 9.0      LAST MODIFIED: 02/24/99   BY: *J3BW* Kedar Deherkar    */
/* REVISION: 9.0      LAST MODIFIED: 03/13/99   BY: *M0BD* Alfred Tan        */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KP* myb                 */

/* SUPPLIER SCHEDULE DETAIL MAINT SUBPROGRAM */
/*J0J6* SPELLED OUT ALL KEYWORDS AND REMOVED ABBREVIATIONS */
         {mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rssmtb_p_1 "Comments"
/* MaxLen: Comment: */

&SCOPED-DEFINE rssmtb_p_2 " Schedule Detail Data "
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

         define input parameter sch_recid as recid.

         define variable i as integer.
         define variable schddet_recid as recid.
         define variable where_we_are as integer.
         define variable del-yn like mfc_logical.
         define variable cmmts like mfc_logical label {&rssmtb_p_1}.
         define variable prior_cum_qty like schd_upd_qty.
         define new shared variable cmtindx like cmt_indx.
         define variable comment_type as character.
         define variable new_schd_det like mfc_logical.
/*J3BW*/ define variable l_is_first   like mfc_logical no-undo.

         find sch_mstr where recid(sch_mstr) = sch_recid no-lock.

         find pod_det where pod_nbr = sch_nbr
                        and pod_line = sch_line
         no-lock.

         comment_type = "ss".

         for each schd_det where schd_type = sch_type
                             and schd_nbr = sch_nbr
                             and schd_line = sch_line
                             and schd_rlse_id = sch_rlse_id
         exclusive-lock:

            if sch_cumulative then do:
               schd_upd_qty = schd_cum_qty.
            end.
            else do:
               schd_upd_qty = schd_discr_qty.
            end.

         end. /* for each schd_det */

/*J39V*/ /*V8:EditableDownFrame=sched_det */
         FORM /*GUI*/ 
            space(5)
            schd_date
            schd_time
            schd_reference
            schd_upd_qty
            schd_fc_qual
/*H0TN*  with frame sched_det 10 down centered  */
/*H0TN*/ with frame sched_det down centered
/*J39V** /*GN40*/ /*V8-*/ scroll 1 /*V8+*/ attr-space width 80 */
/*J39V*/ scroll 1 attr-space width 80
/*G0MD*  title "Schedule Detail Data". */
/*H1HV*/ no-validate
/*G0MD*/ title color normal (getFrameTitle("SCHEDULE_DETAIL_DATA",29)) THREE-D /*GUI*/.


/* SET EXTERNAL LABELS */
setFrameLabels(frame sched_det:handle).

/*J0J6   pause 0 before-hide. */
/*J0J6*/ pause 0.

         mainloop:
         do transaction with frame sched_det:
/*GUI*/ if global-beam-me-up then undo, leave.

            clear frame sched_det all no-pause.
            view frame sched_det.

            find first schd_det where schd_type = sch_type
                                  and schd_nbr = sch_nbr
                                  and schd_line = sch_line
                                  and schd_rlse_id = sch_rlse_id
            no-lock no-error.

            i = 0.
            do while i < frame-down and available schd_det:
               display
                  schd_date
                  schd_time
                  schd_reference
                  schd_upd_qty
                  schd_fc_qual.

               i = i + 1.
               if i < frame-down then down 1.

               find next schd_det where schd_type = sch_type
                                    and schd_nbr = sch_nbr
                                    and schd_line = sch_line
                                    and schd_rlse_id = sch_rlse_id
               no-lock no-error.
            end. /* do while i < frame-down */

            up frame-line - 1.

            find first schd_det where schd_type = sch_type
                                  and schd_nbr = sch_nbr
                                  and schd_line = sch_line
                                  and schd_rlse_id = sch_rlse_id
            no-lock no-error.

            detail-loop:
            repeat with frame sched_det:
/*GUI*/ if global-beam-me-up then undo, leave.


               ststatus = stline[1].
               status input ststatus.

               pause before-hide.
               prompt-for schd_date schd_time schd_reference
               go-on(F9 F10 CURSOR-UP CURSOR-DOWN).
/*J0J6   pause 0 before-hide. */
/*J0J6*/ pause 0.

               if frame-field = "schd_date" then
                  next-prompt schd_date.
               else
               if frame-field = "schd_time" then
                  next-prompt schd_time.
               else
               if frame-field = "schd_reference" then
                  next-prompt schd_reference.

/*H1HV*/       /* VALIDATE DATE FIELD */
/*H1HV*/       if input schd_date = ? then do:
/*H1HV*/          {mfmsg.i 27 3} /* INVALID DATE */
/*H1HV*/          next-prompt schd_date with frame sched_det.
/*H1HV*/          undo, retry.
/*H1HV*/       end.

               do while
               lastkey = keycode("F9")
               or lastkey = keycode("CURSOR-UP")
               or lastkey = keycode("F10")
               or lastkey = keycode("CURSOR-DOWN")
               on endkey undo, leave detail-loop:

                  if available schd_det then do:

                     if lastkey = keycode("F9")
                     or lastkey = keycode("CURSOR-UP")
                     then do:

/*J39V** BEGIN DELETE **
 *                      display
 *                         schd_date
 *                         schd_time
 *                         schd_reference
 *                         schd_upd_qty
 *                         schd_fc_qual.
 *J39V** END DELETE **/

                        find prev schd_det where schd_type = sch_type
                                             and schd_nbr = sch_nbr
                                             and schd_line = sch_line
                                             and schd_rlse_id = sch_rlse_id
                        exclusive-lock no-error.
                        if available schd_det then do:
                           up 1.
                           display
                              schd_date
                              schd_time
                              schd_reference
                              schd_upd_qty
                              schd_fc_qual.
                        end.
                        else do:
                           find first schd_det where schd_type = sch_type
                                                 and schd_nbr = sch_nbr
                                                 and schd_line = sch_line
                                                 and schd_rlse_id =
                                                 sch_rlse_id
                           exclusive-lock no-error.
                           bell.
                        end.
                     end. /* if F9 or CURSOR-UP */

                     else
                     if lastkey = keycode("F10")
                     or lastkey = keycode("CURSOR-DOWN")
                     then do:

/*J39V** BEGIN DELETE **
 *                      display
 *                         schd_date
 *                         schd_time
 *                         schd_reference
 *                         schd_upd_qty
 *                         schd_fc_qual.
 *J39V** END DELETE **/

                        find next schd_det where schd_type = sch_type
                                             and schd_nbr = sch_nbr
                                             and schd_line = sch_line
                                             and schd_rlse_id = sch_rlse_id
                        exclusive-lock no-error.
                        if available schd_det then do:
                           down 1.
                           display
                              schd_date
                              schd_time
                              schd_reference
                              schd_upd_qty
                              schd_fc_qual.
                        end.
                        else do:
                           find last schd_det where schd_type = sch_type
                                                and schd_nbr = sch_nbr
                                                and schd_line = sch_line
                                                and schd_rlse_id = sch_rlse_id
                           exclusive-lock no-error.
                           bell.
                        end.
                     end. /* if F10 or CURSOR-DOWN */

                  end. /* if available schd_det */

                  ststatus = stline[1].
                  status input ststatus.

                  pause before-hide.
                  prompt-for schd_date schd_time schd_reference
                  go-on(F9 F10 CURSOR-UP CURSOR-DOWN).
/*J0J6            pause 0 before-hide. */
/*J0J6*/          pause 0.

                  if frame-field = "schd_date" then
                     next-prompt schd_date.
                  else
                  if frame-field = "schd_time" then
                     next-prompt schd_time.
                  else
                  if frame-field = "schd_reference" then
                     next-prompt schd_reference.

/*H1HV*/          /* VALIDATE DATE FIELD */
/*H1HV*/          if input schd_date = ? then do:
/*H1HV*/             {mfmsg.i 27 3} /* INVALID DATE */
/*H1HV*/             next-prompt schd_date with frame sched_det.
/*H1HV*/             undo, retry.
/*H1HV*/          end.

               end. /* do while lookup */

               find schd_det where schd_type = sch_type
                               and schd_nbr = sch_nbr
                               and schd_line = sch_line
                               and schd_rlse_id = sch_rlse_id
                               and schd_date = input schd_date
                               and schd_time = input schd_time
                               and schd_interval = ""
                               and schd_reference = input schd_reference
               exclusive-lock no-error.

               if not available schd_det then do:

                  new_schd_det = yes.

                  {mfmsg.i 1 1} /* ADDING NEW RECORD */

                  create schd_det.
                  assign
                     schd_type = sch_type
                     schd_nbr = sch_nbr
                     schd_line = sch_line
                     schd_rlse_id = sch_rlse_id
                     schd_date
                     schd_time
                     schd_interval = ""
                     schd_reference.

/*J3BW*/          if recid(schd_det) = -1 then .

                  assign
                     schd_fc_qual = "P".

               end.
               else new_schd_det = no.

               schddet_recid = recid(schd_det).
               where_we_are = frame-line.

/*J3BW*/       /* SET RECORD POINTER BEFORE ITERATIVELY FINDING PREV RECORD. */
/*J3BW*/       find schd_det where recid(schd_det) = schddet_recid
/*J3BW*/       exclusive-lock.

/*J3BW*/       if new_schd_det and frame-line <> frame-down
/*J3BW*/       then do:
/*J3BW*/          do i = 1 to frame-down - 1  while available schd_det:
/*J3BW*/             find prev schd_det
/*J3BW*/                where schd_type     = sch_type
/*J3BW*/                  and schd_nbr      = sch_nbr
/*J3BW*/                  and schd_line     = sch_line
/*J3BW*/                  and schd_rlse_id  = sch_rlse_id
/*J3BW*/                no-lock no-error.
/*J3BW*/          end. /* DO I = 1 TO FRAME-DOWN - 1 */

/*J3BW*/          if available schd_det
/*J3BW*/          then do:
/*J3BW*/             find prev schd_det
/*J3BW*/                where schd_type     = sch_type
/*J3BW*/                  and schd_nbr      = sch_nbr
/*J3BW*/                  and schd_line     = sch_line
/*J3BW*/                  and schd_rlse_id  = sch_rlse_id
/*J3BW*/                no-lock no-error.
/*J3BW*/          end. /* IF AVAIL SCHD_DET  */
/*J3BW*/       end. /* IF NEW_SCHD_DET AND.. */
/*J3BW*/       else
                  do i = 1 to where_we_are while available schd_det:
                     find prev schd_det where schd_type = sch_type
                                          and schd_nbr = sch_nbr
                                          and schd_line = sch_line
                                          and schd_rlse_id = sch_rlse_id
                     no-lock no-error.
                  end.

/*J3BW*/       /* DETERMINE IF THE TOP MOST RECORD IN THE FRAME IS VERY FIRST */
/*J3BW*/       /* schd_det RECORD */
/*J3BW*/       if not available schd_det
/*J3BW*/       then
/*J3BW*/          l_is_first = yes.
/*J3BW*/       else
/*J3BW*/          l_is_first = no.

               up where_we_are - 1.

               do i = 1 to frame-down:
/*J3BW*/          if i = 1 and l_is_first
/*J3BW*/          then
/*J3BW*/             find first schd_det where schd_type    = sch_type and
/*J3BW*/                                       schd_nbr     = sch_nbr  and
/*J3BW*/                                       schd_line    = sch_line and
/*J3BW*/                                       schd_rlse_id = sch_rlse_id
/*J3BW*/             no-lock no-error.
/*J3BW*/          else
                     find next schd_det where schd_type = sch_type
                                          and schd_nbr = sch_nbr
                                          and schd_line = sch_line
                                          and schd_rlse_id = sch_rlse_id
                     no-lock no-error.

                  if available schd_det then do:
                     display
                        schd_date
                        schd_time
                        schd_reference
                        schd_upd_qty
                        schd_fc_qual.

                     if recid(schd_det) = schddet_recid then do:
                        where_we_are = frame-line.
                     end.
                  end.
                  else do:
                     display
                        "" @ schd_date
                        "" @ schd_time
                        "" @ schd_reference
                        "" @ schd_upd_qty
                        "" @ schd_fc_qual.
                  end.

                  if i < frame-down then down 1.

               end. /* do i = 1 to frame-down */

               up frame-down - where_we_are.
               find schd_det where recid(schd_det) = schddet_recid
               exclusive-lock.
               schddet_recid = recid(schd_det).

               ststatus = stline[2].
               status input ststatus.

               do on error undo, retry:
/*GUI*/ if global-beam-me-up then undo, leave.

                  pause before-hide.
                  prompt-for schd_upd_qty schd_fc_qual
/*GO05*/          /*V8+*/

/*J2PK** BEGIN DELETE**
 * /*GO05*/        /*V8!
 *                 go-on(ESC CTRL-D F9 F10 CURSOR-UP CURSOR-DOWN). */
 *J2PK** END DELETE */

/*J2PK*/                go-on(ESC F5 CTRL-D F9 F10 CURSOR-UP CURSOR-DOWN).   

/*J0J6            pause 0 before-hide. */
/*J0J6*/          pause 0.

                  if input schd_fc_qual = "f" and pod_firm_days = 0 then do:
                     {mfmsg.i 8198 3} /* FIRM NOT ALLWD, FIRM DAYS IS 0 */
                     next-prompt schd_fc_qual.
                     undo, retry.
                  end.
               end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* do on error undo */

               if frame-field = "schd_upd_qty" then
                  next-prompt schd_upd_qty.
               else
               if frame-field = "schd_fc_qual" then
                  next-prompt schd_fc_qual.

               datafield-update:
               do while lastkey = keycode("F9")
                     or lastkey = keycode("CURSOR-UP")
                     or lastkey = keycode("F10")
                     or lastkey = keycode("CURSOR-DOWN"):

                  new_schd_det = no.

                  if lastkey = keycode("F9")
                  or lastkey = keycode("CURSOR-UP")
                  then do:
                     assign
                        schd_upd_qty
                        schd_fc_qual.

                     find prev schd_det where schd_type = sch_type
                                          and schd_nbr = sch_nbr
                                          and schd_line = sch_line
                                          and schd_rlse_id = sch_rlse_id
                     exclusive-lock no-error.
                     if available schd_det then do:
                        up 1.
                        display
                           schd_date
                           schd_time
                           schd_reference
                           schd_upd_qty
                           schd_fc_qual.
                     end.
                     else do:
                        find first schd_det where schd_type = sch_type
                                              and schd_nbr = sch_nbr
                                              and schd_line = sch_line
                                              and schd_rlse_id = sch_rlse_id
                        exclusive-lock no-error.
                        bell.
                     end.
                  end. /* if F9 or CURSOR-UP */

                  else
                  if lastkey = keycode("F10")
                  or lastkey = keycode("CURSOR-DOWN")
                  then do:
                     assign
                        schd_upd_qty
                        schd_fc_qual.

                     find next schd_det where schd_type = sch_type
                                          and schd_nbr = sch_nbr
                                          and schd_line = sch_line
                                          and schd_rlse_id = sch_rlse_id
                     exclusive-lock no-error.

                     if available schd_det then do:
                        down 1.
                        display
                           schd_date
                           schd_time
                           schd_reference
                           schd_upd_qty
                           schd_fc_qual.
                     end.
                     else do:
                        find last schd_det where schd_type = sch_type
                                             and schd_nbr = sch_nbr
                                             and schd_line = sch_line
                                             and schd_rlse_id = sch_rlse_id
                        exclusive-lock no-error.
                        bell.
                     end.
                  end. /* if F10 or CURSOR-DOWN */

                  ststatus = stline[2].
                  status input ststatus.

                  do on error undo, retry:
/*GUI*/ if global-beam-me-up then undo, leave.

                     pause before-hide.
                     prompt-for schd_upd_qty schd_fc_qual
/*GO05*/             /*V8+*/

/*J2PK** BEGIN DELETE**
 * /*GO05*/        /*V8!
 *                 go-on(ESC CTRL-D F9 F10 CURSOR-UP CURSOR-DOWN). */
 *J2PK** END DELETE */

/*J2PK*/                 go-on(ESC F5 CTRL-D F9 F10 CURSOR-UP CURSOR-DOWN).   

/*J0J6               pause 0 before-hide. */
/*J0J6*/             pause 0.

                     if input schd_fc_qual = "f" and pod_firm_days = 0 then do:
                        {mfmsg.i 8198 3} /* FIRM NOT ALLWD, FIRM DAYS IS 0 */
                        next-prompt schd_fc_qual.
                        undo, retry.
                     end.
                  end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* do on error undo, retry */

                  if frame-field = "schd_upd_qty" then
                     next-prompt schd_upd_qty.
                  else
                  if frame-field = "schd_fc_qual" then
                     next-prompt schd_fc_qual.

               end. /* datafield-update do while */

               datafield-update:
               do while lastkey = keycode("F9")
                     or lastkey = keycode("CURSOR-UP")
                     or lastkey = keycode("F10")
                     or lastkey = keycode("CURSOR-DOWN"):

                  new_schd_det = no.

                  if frame-field = "schd_upd_qty" then
                     next-prompt schd_upd_qty.
                  else
                  if frame-field = "schd_fc_qual" then
                     next-prompt schd_fc_qual.
               end. /* datafield-update */

               if lastkey = keycode("F5")
               or lastkey = keycode("CTRL-D") then do:
                  del-yn = yes.
                  {mfmsg01.i 11 1 del-yn} /* PLEASE CONFIRM DELETE */
                  if del-yn = no then do:
                     display
                        schd_date
                        schd_time
                        schd_reference
                        schd_upd_qty.
                     next detail-loop.
                  end.

                  find schd_det where schd_type = sch_type
                                  and schd_nbr = sch_nbr
                                  and schd_line = sch_line
                                  and schd_rlse_id = sch_rlse_id
                                  and schd_date = input schd_date
                                  and schd_time = input schd_time
                                  and schd_interval = ""
                                  and schd_reference = input schd_reference
                  exclusive-lock no-error.

                  delete schd_det.

                  where_we_are = frame-line.

                  find next schd_det where schd_type = sch_type
                                       and schd_nbr = sch_nbr
                                       and schd_line = sch_line
                                       and schd_rlse_id = sch_rlse_id
                  no-lock no-error.

                  if available schd_det then do:
                     schddet_recid = recid(schd_det).

                     display
                        schd_date
                        schd_time
                        schd_reference
                        schd_upd_qty
                        schd_fc_qual.

                     do i = where_we_are to frame-down - 1:
                        down 1.
                        find next schd_det where schd_type = sch_type
                                             and schd_nbr = sch_nbr
                                             and schd_line = sch_line
                                             and schd_rlse_id = sch_rlse_id
                        no-lock no-error.
                        if available schd_det then do:
                           display
                              schd_date
                              schd_time
                              schd_reference
                              schd_upd_qty
                              schd_fc_qual.
                        end.
                        else do:
                           display
                              "" @ schd_date
                              "" @ schd_time
                              "" @ schd_reference
                              "" @ schd_upd_qty
                              "" @ schd_fc_qual.
                        end.
                     end. /* do i = where_we_are */

                     up frame-down - where_we_are.
                     find schd_det where recid(schd_det) = schddet_recid
                     exclusive-lock.

                  end. /* if available schd_det */
                  else do:
                     display
                        "" @ schd_date
                        "" @ schd_time
                        "" @ schd_reference
                        "" @ schd_upd_qty
                        "" @ schd_fc_qual.

                     find prev schd_det where schd_type = sch_type
                                          and schd_nbr = sch_nbr
                                          and schd_line = sch_line
                                          and schd_rlse_id = sch_rlse_id
                     exclusive-lock no-error.
                     if available schd_det then do:
                        up 1.
                        display
                           schd_date
                           schd_time
                           schd_reference
                           schd_upd_qty
                           schd_fc_qual.
                     end.
                  end.

               end. /* if lastkey = F5 */

               else
/*GO05*        if lastkey = keycode("CTRL-E")
 *             or lastkey = keycode("F4")
 *             or lastkey = keycode("PF4") */
/*GO05*/       if keyfunction(lastkey) = "END-ERROR"
               then do:
                  display
                     schd_upd_qty
                     schd_fc_qual.
               end.

               else do:
                  assign
                     schd_upd_qty
                     schd_fc_qual.

                  /*F312 ADDED FOLLOWING SECTION*/
                  if new_schd_det and frame-line <> frame-down then do:

                     schddet_recid = recid(schd_det).
                     where_we_are = frame-line.

                     do i = 1 to where_we_are + 1 while available schd_det:
                        find prev schd_det where schd_type = sch_type
                                             and schd_nbr = sch_nbr
                                             and schd_line = sch_line
                                             and schd_rlse_id = sch_rlse_id
                        no-lock no-error.
                     end.

                     up where_we_are - 1.

/*J3BW*/             /* DETERMINE IF THE TOP MOST RECORD IN THE FRAME */
/*J3BW*/             /* IS VERY FIRST SCHD_DET RECORD                 */
/*J3BW*/             if not available schd_det
/*J3BW*/             then
/*J3BW*/                l_is_first = yes.
/*J3BW*/             else
/*J3BW*/                l_is_first = no.

                     do i = 1 to frame-down:
/*J3BW*/                if i = 1 and l_is_first
/*J3BW*/                then
/*J3BW*/                   for first schd_det
/*J3BW*/                      fields (schd_type schd_nbr schd_line schd_rlse_id
/*J3BW*/                         schd_date schd_time schd_reference schd_upd_qty
/*J3BW*/                         schd_fc_qual schd_interval schd_reference
/*J3BW*/                         schd_upd_qty schd_discr_qty schd_cum_qty) where
/*J3BW*/                                 schd_type = sch_type
/*J3BW*/                                 and schd_nbr = sch_nbr
/*J3BW*/                                 and schd_line = sch_line
/*J3BW*/                                 and schd_rlse_id = sch_rlse_id
/*J3BW*/                   no-lock:
/*J3BW*/                   end. /* FOR FIRST SCHD_DET */
/*J3BW*/                else
                           find next schd_det where schd_type = sch_type
                                                and schd_nbr = sch_nbr
                                                and schd_line = sch_line
                                                and schd_rlse_id = sch_rlse_id
                           no-lock no-error.

                        if available schd_det then do:
                           display
                              schd_date
                              schd_time
                              schd_reference
                              schd_upd_qty
                              schd_fc_qual.

                           if recid(schd_det) = schddet_recid then do:
                              where_we_are = frame-line.
                           end.
                        end.
                        else do:
                           display
                              "" @ schd_date
                              "" @ schd_time
                              "" @ schd_reference
                              "" @ schd_upd_qty
                              "" @ schd_fc_qual.
                        end.

                        if i < frame-down then down 1.

                     end. /* do i = 1 to frame-down */

                     up frame-down - where_we_are.
                     find schd_det where recid(schd_det) = schddet_recid
                     exclusive-lock.
                     schddet_recid = recid(schd_det).

                  end. /* if new_sched_det */
                  /*F312 END SECTION*/

               end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* else do */

            end.
/*GUI*/ if global-beam-me-up then undo, leave.
  /* detail-loop */

            prior_cum_qty = sch_pcr_qty.

            for each schd_det where schd_type = sch_type
                                and schd_nbr = sch_nbr
                                and schd_line = sch_line
                                and schd_rlse_id = sch_rlse_id
            exclusive-lock:
/*GUI*/ if global-beam-me-up then undo, leave.

               if sch_cumulative then do:
                  if schd_upd_qty < prior_cum_qty then do:
                     /* CUM QTYS ARE NOT IN ASCENDING VALUE ORDER */
                     {mfmsg.i 6009 3}
                     undo mainloop, retry mainloop.
                  end.

                  schd_cum_qty = schd_upd_qty.
                  schd_discr_qty = schd_cum_qty - prior_cum_qty.
                  prior_cum_qty = prior_cum_qty + schd_discr_qty.
               end. /* if sch_cumulative */
               else do:
                  schd_discr_qty = schd_upd_qty.
                  prior_cum_qty = prior_cum_qty + schd_discr_qty.
                  schd_cum_qty = prior_cum_qty.
               end.
            end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* for each */

         end. /* mainloop */

ststatus = stline[2].
status input ststatus.
hide frame sched_det no-pause.
pause before-hide.
